﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BiblioWeb.DataAccess;
using BiblioWeb.Models;

namespace MvcMusicStore.Controllers
{
    //[Authorize(Roles = "Administrator")]
    public class OperacionManagerController : Controller
    {

        private ContextoBiblio db;
        private UsuarioRepo UsuarioRepo;

        public OperacionManagerController()
        {
            this.db = new ContextoBiblio();
            this.UsuarioRepo = new UsuarioRepo(db);
        }

        //
        // GET: /StoreManager/

        public ViewResult Index()
        {
            var usuarios = db.Usuarios.Include(a => a.Nombre).Include(a => a.Apellido);
            return View(usuarios.ToList());
        }

        //
        // GET: /StoreManager/Details/5

        public ViewResult Details(int id)
        {
            Usuario usuario = db.Usuarios.Find(id);
            return View(usuario);
        }

        ////
        //// GET: /StoreManager/Create

        //public ActionResult Create()
        //{
        //    ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");
        //    ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name");
        //    return View();
        //} 

        //
        // POST: /StoreManager/Create

        //[HttpPost]
        //public ActionResult Create(Album album)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Albums.Add(album);
        //        db.SaveChanges();
        //        return RedirectToAction("Index");  
        //    }

        //    ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
        //    ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
        //    return View(album);
        //}
        
        //
        // GET: /StoreManager/Edit/5
 
        //public ActionResult Edit(int id)
        //{
        //    Usuario usuario = db.Usuarios.Find(id);
        //    ViewBag.GenreId = new SelectList(db.Reservas, "IdReserva", "UserName", album.GenreId);
        //    ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
        //    return View(album);
        //}

        //
        // POST: /StoreManager/Edit/5

        //[HttpPost]
        //public ActionResult Edit(Album album)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(album).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("Index");
        //    }
        //    ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
        //    ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
        //    return View(album);
        //}

        //
        // GET: /StoreManager/Delete/5
 
        //public ActionResult Delete(int id)
        //{
        //    Album album = db.Albums.Find(id);
        //    return View(album);
        //}

        //
        // POST: /StoreManager/Delete/5

        //[HttpPost, ActionName("Delete")]
        //public ActionResult DeleteConfirmed(int id)
        //{            
        //    Album album = db.Albums.Find(id);
        //    db.Albums.Remove(album);
        //    db.SaveChanges();
        //    return RedirectToAction("Index");
        //}

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}